﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public partial class PlatForm_MasterPage2 : System.Web.UI.MasterPage
{
	/// <summary>
	/// 专家控制类对象
	/// </summary>
	private PX.Expert.ExpertComponent clsExpertComp = new PX.Expert.ExpertComponent();		// 专家控制类对象
	/// <summary>
	/// 用户控制类
	/// </summary>
	private PX.User.UserComponent clsUserComp = new PX.User.UserComponent();		// 用户控制类
	/// <summary>
	/// 用户组控制类
	/// </summary>
	private PX.UserGroup.UserGroupComponent clsUserGroupComp = new PX.UserGroup.UserGroupComponent();		// 用户组控制类
	/// <summary>
	/// 提问者控制类
	/// </summary>
	private PX.Asker.Component clsAskerComp = new PX.Asker.Component();		// 提问者控制类

	protected void Page_Load(object sender, EventArgs e)
	{
		ShowExperts();
	}

	/// <summary>
	/// 显示所有专家
	/// </summary>
	private void ShowExperts()
	{
		List<PX.Expert.Expert> listExpertOne = new List<PX.Expert.Expert>();		// 博士后专家
		List<PX.Expert.Expert> listExpertTwo = new List<PX.Expert.Expert>();		// 技能大师
		List<PX.Expert.Expert> listExpert = new List<PX.Expert.Expert>();		// 所有专家

		listExpertOne = clsExpertComp.QueryExpertOne();
		listExpertTwo = clsExpertComp.QueryExpertTwo();

		for (int i = 0; i < listExpertOne.Count; i++)
		{
			listExpert.Add(listExpertOne[i]);
		}

		for (int i = 0; i < listExpertTwo.Count; i++)
		{
			listExpert.Add(listExpertTwo[i]);
		}

		for (int i = 0; i < listExpert.Count; i++)
		{
			Panel panelOneExpert = new Panel();
			Panel panelExpertName = new Panel();
			Panel panelExpertImage = new Panel();
			Panel panelExpertQuestion = new Panel();
			Label labelExpertName = new Label();
			Image imageExpertImage = new Image();
			HyperLink hLinkIntroduction = new HyperLink();
			HyperLink hLinkQuestion = new HyperLink();
			Label labSplit = new Label();

			panelOneExpert.CssClass = "OneExpert";
			panelExpertName.CssClass = "ExpertName";
			panelExpertImage.CssClass = "DivImage";
			panelExpertQuestion.CssClass = "DivQuestion";
			imageExpertImage.CssClass = "Icon";
			labSplit.CssClass = "Split";
			hLinkIntroduction.CssClass = "ExpertBt";
			hLinkQuestion.CssClass = "ExpertBt";

			hLinkIntroduction.Text = "简介";
			hLinkQuestion.Text = "提问";
			labSplit.Text = "|";

			hLinkIntroduction.NavigateUrl = "Introduction.aspx?ID=" + listExpert[i].ID;
			hLinkQuestion.NavigateUrl = "Ask.aspx?ExpertID=" + listExpert[i].ID;

			labelExpertName.Text = listExpert[i].Job + listExpert[i].TypeName + "：" + listExpert[i].Name;
			panelExpertName.Controls.Add(labelExpertName);

			imageExpertImage.ImageUrl = "~/ShowImage.aspx?FileID=" + listExpert[i].ImageID.ToString();
			panelExpertImage.Controls.Add(imageExpertImage);

			panelExpertQuestion.Controls.Add(hLinkIntroduction);
			//panelExpertQuestion.Controls.Add(labSplit);
			panelExpertQuestion.Controls.Add(hLinkQuestion);

			panelOneExpert.Controls.Add(panelExpertName);
			panelOneExpert.Controls.Add(panelExpertImage);
			panelOneExpert.Controls.Add(panelExpertQuestion);

			PanelExperts.Controls.Add(panelOneExpert);
		}

	}

	public string GetMarqueeID()
	{
		return PanelExperts.ClientID;
	}
}
